/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.longview.io.modules.sys.entity;

import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonBackReference;

import com.longview.io.common.persistence.TreeEntity;

/**
 * 预警类型树形结构Entity
 * @author zf
 * @version 2017-11-08
 */
public class AlertType extends TreeEntity<AlertType> {
	
	private static final long serialVersionUID = 1L;
	private String name;		// 告警类型
	private String parentIds;		// parent_ids
	private String codecoding;		// 编码
	private AlertType parent;		// 上级ID
	private String fathername;		// 上级名称
	private String remark;		// 备注
	
	public AlertType() {
		super();
	}

	public AlertType(String id){
		super(id);
	}

	@Length(min=0, max=100, message="告警类型长度必须介于 0 和 100 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Length(min=0, max=2000, message="parent_ids长度必须介于 0 和 2000 之间")
	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}
	
	@Length(min=0, max=10, message="编码长度必须介于 0 和 10 之间")
	public String getCodecoding() {
		return codecoding;
	}

	public void setCodecoding(String codecoding) {
		this.codecoding = codecoding;
	}
	
	@JsonBackReference
	public AlertType getParent() {
		return parent;
	}

	public void setParent(AlertType parent) {
		this.parent = parent;
	}
	
	@Length(min=0, max=100, message="上级名称长度必须介于 0 和 100 之间")
	public String getFathername() {
		return fathername;
	}

	public void setFathername(String fathername) {
		this.fathername = fathername;
	}
	
	@Length(min=0, max=100, message="备注长度必须介于 0 和 100 之间")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
}